<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<script src="vue.js" type="text/javascript" charset="utf-8"></script>
	</head>
	<body>
		<div id="app">
			{{a}}
		</div>
		<script type="text/javascript">
			var data = {a:1};
			var vm = new Vue({
				el: '#app',
				data: data
			})
			
			// 观察元素的变化，回调函数参数：新值、旧值
			vm.$watch('a', function(newVal, oldval) {
				console.log(oldval, newVal);
			})
			
			// 可通过以下两种方式修改变量的值
			data.a = "new val0";
			vm.a = "new val2";
		</script>
	</body>
</html>
